home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / admin / top20net / bu / bu.doc < prev    next >
Encoding:
Text File  |  1995-03-24  |  10.5 KB  |  296 lines

  1.  
  2.  
  3.  
  4.  
  5.                            BU - Batch Utility V4.00
  6.  
  7.              Copyright (c) 1987-1995 by Danen Information Services
  8.                               All Rights Reserved
  9.  
  10.  
  11.  
  12.  
  13.         This program may be distributed freely, as long as no money is
  14.         charged.  The program and documentation may not be modified
  15.         without the author's permission.
  16.  
  17.  
  18.  
  19.  
  20.                                   DISCLAIMER
  21.  
  22.         This program is distributed "as is." The author makes no
  23.         claims as to the suitability of this program, nor is he
  24.         responsible for losses due to misuse or abuse of the program.
  25.         The user assumes all responsibility for determining if this
  26.         program is suitable for his purposes.
  27.  
  28.  
  29.  
  30.                                   Introduction
  31.  
  32.  
  33. The purpose of this program is to enhance the use of MS-DOS batch files.
  34.  
  35. "BU" replaces a number of separate utility programs, such as:  ASK, CRLF,
  36. CURSOR, HEADER, HITENTER, MSG, REDALERT, SOUND, TIMER, WARBLE, and YN.  It also
  37. adds functions not found in those older programs.
  38.  
  39. There are several reasons to combine all these functions into one program.
  40. First of all, the individual functions have been standardized.  Secondly, you
  41. will save disk space by using only one program.  Thirdly, the sound functions
  42. are adapted to the speed of your processor.
  43.  
  44. The syntax for the program is simple.  The very first letter on the command
  45. line is the key code.  This code may be followed by a "clear screen indicator"
  46. which clears the screen before the requested function is executed.
  47.  
  48. Then, optional arguments follow which are applicable to the requested function.
  49. For example, the "header" function takes the rest of the command line and
  50. displays it in a box on the screen, and the "sound" function looks at the first
  51. letter of the rest of the command line to determine which sound to produce.
  52.  
  53. If you don't like the noises, set the environment variable GD.SOUND to OFF:
  54.  
  55.                                SET GD.SOUND=OFF
  56.  
  57. Key Codes
  58.  
  59.            P  -  Pause, wait for [Enter]        1)
  60.            C  -  Enter Character                1)
  61.            Y  -  Enter Y or N                   1)
  62.            D  -  Dump File to Screen
  63.            F  -  Display File
  64.            H  -  Display Header                 1)
  65.            M  -  Display Message                1) 2)
  66.            B  -  Display Blank Line                2)
  67.            T  -  Display Day, Date, and Time       2)
  68.            S  -  Sound                                3)
  69.            W  -  Wait for a number of Seconds
  70.            ^  -  Clear the Screen, DOS CLS replacement
  71.            _  -  Set Cursor to Normal, Big, or Hidden
  72.  
  73. All codes may be followed by ^, which will clear the screen first, e.g.  P^,
  74. Y^, etc.  Code H and H^ work the same, and so do ^ and ^^.
  75.  
  76.       1)   These codes may be followed by a message to be displayed.
  77.  
  78.       2)   These functions use DOS for the display, so the information may be
  79.            redirected to a file or printer.  If you have used ANSI.SYS to set
  80.            colours, these three functions will display text in those colours.
  81.  
  82.       3)   Follow this code by B(eep), G(lissando), N(oise), P(hone), R(ed
  83.            Alert), or W(arble).
  84.  
  85. Examples of all codes are found in BU-DEMO.BAT.
  86.  
  87.  
  88. PAUSE:
  89.  
  90. Key code P or P^.  Acts as a replacement for the DOS PAUSE command.  The DOS
  91. command asks to strike "any" key when ready.  That can cause problems if you
  92. accidentally hit a key.  For example, you ask the user to insert a new disk in
  93. drive A:  and use the DOS PAUSE command.  If the user, by reaching for the disk
  94. happens to hit the space bar, disastrous things could happen.  BU's PAUSE only
  95. accepts the [Enter] key, which is less likely to be hit by accident.
  96.  
  97. The optional message is displayed, followed by:
  98.  
  99.        Press the [Enter] key to continue, or [Ctrl]/[Break] to abort...
  100.  
  101.  
  102. ENTER CHARACTER:
  103.  
  104. Key code C or C^.  This function waits for the user to enter a keystroke, and
  105. sets an errorlevel code which can be examined in the batch file.  There are two
  106. modes of operation for this function, one where ANY key is accepted, and one
  107. where only valid characters are accepted.  All lowercase letters are converted
  108. to uppercase letters, regardless of processing mode.
  109.  
  110. If the rest of command line starts with a "{" then the program assumes that a
  111. list of accep- table characters follows, terminated with a "}".  If such a list
  112. is given, then only a character from the list is allowed to be entered, and an
  113. errorlevel is returned corresponding to the position in the list.  For example,
  114. if {ABC} is the given list, and the "B" was entered, errorlevel 2 is returned.
  115. In order for this procedure to work properly, all characters given must be
  116. unique.  If {abcA} is handed to the program, it will never return errorlevel 4!
  117.  
  118. A second "{}" string may be included, to indicate a default response, and how
  119. many seconds to wait before this default is assumed to have been type.  This
  120. can be very useful for unattended AUTOEXEC.BAT files of a BBS computer, or a
  121. file server, where the computer can load the required programs after a power
  122. outage, for example.  Syntax of this string is "{k:secs}", where "k" is the
  123. default key, and "secs" is the number of seconds to wait.  See BU-DEMO.BAT for
  124. an example.
  125.  
  126. If no list is given, then the ASCII value of the character is returned in the
  127. errorlevel.  If a "Q" is entered, the errorlevel is set to 81.
  128.  
  129. Example of using a list of valid characters:
  130.  
  131.       :menu
  132.       bu h Menu to test sounds:
  133.       echo Red Alert
  134.       echo Warble
  135.       echo Quit
  136.       bu c {rwq} Select an option
  137.       if errorlevel 3 goto m-end
  138.       if errorlevel 2 goto m-2
  139.       if errorlevel 1 goto m-1
  140.       bu p Should never get here!
  141.       :m-1
  142.       bu s Red
  143.       goto menu
  144.       :m-2
  145.       bu s Warble
  146.       goto menu
  147.       :m-end
  148.  
  149. Example of using ASCII codes:
  150.  
  151.       :menu
  152.       bu h Menu to test sounds:
  153.       echo Red Alert
  154.       echo Warble
  155.       echo Quit
  156.       bu c Select an option
  157.       rem R=82, W=87, Q=81 --- this is compatible with the old ASK program!
  158.       if errorlevel 88 goto menu
  159.       if errorlevel 87 goto m-2
  160.       if errorlevel 83 goto menu
  161.       if errorlevel 82 goto m-1
  162.       if errorlevel 81 goto m-end
  163.       goto menu
  164.       :m-1
  165.       bu s Red
  166.       goto menu
  167.       :m-2
  168.       bu s Warble
  169.       goto menu
  170.       :m-end
  171.  
  172.  
  173. ENTER YES OR NO:
  174.  
  175. Key code Y or Y^.  This function works much like the "enter character" function
  176. with a list option of {YN}.  This function accepts a default value as {?},
  177. where ?  is a Y or N.  Pressing [Enter] causes the default value to be assumed
  178. as entered.  The only other characters the program will accept are "Y" and "N".
  179. Errorlevel 1 is returned for a YES response, a 0 for a NO response.
  180.  
  181. The default {Y} or {N} may also include a number of seconds before this default
  182. response is used.  See "Enter Character" for more information, and check
  183. BU-DEMO.BAT for an example.
  184.  
  185. Example:
  186.  
  187.       rem A default response of "Y" is assumed.
  188.       bu y {y} Do you want to continue
  189.       if errorlevel 1 goto yes_opt
  190.       echo Processing NO option
  191.       goto contin
  192.       :yes_opt
  193.       echo Processing YES option
  194.       :contin
  195.  
  196. Or:
  197.  
  198.       rem No default.  The user must enter Y or N only.
  199.       bu y Do you want to print the audit file
  200.       if errorlevel 1 print audit.fil
  201.       :contin
  202.  
  203.  
  204. DUMP FILE TO SCREEN:
  205.  
  206. Key code D or D^.  The file name following the key code is dumped to the
  207. screen.  Only one screen at most is shown.  Display region is from the cursor
  208. position to the end of the screen.  Useful for building a menu system.
  209.  
  210.  
  211. DISPLAY FILE:
  212.  
  213. Key code F or F^.  The file name following the key code is displayed on the
  214. screen.  Much like the DOS TYPE command, except that the screen output is
  215. faster.
  216.  
  217.  
  218. DISPLAY HEADER:
  219.  
  220. Key code H or H^.  The message following the key code is displayed centered in
  221. a box, after the screen has been cleared.
  222.  
  223.  
  224. DISPLAY MESSAGE:
  225.  
  226. Key code M or M^.  The message following the key code is displayed on the
  227. standard output device.  This is the screen if not re-directed.  The text may
  228. be redirected to a file or the printer if you are logging messages.  Works like
  229. the DOS ECHO command, but displays a blank line before and after the message so
  230. that you don't lose the message if there already is a lot of text on the
  231. screen.  If you specify no text, 3 blank lines are displayed.
  232.  
  233.  
  234. DISPLAY BLANK LINE:
  235.  
  236. Key code B or B^.  A blank line is displayed on the standard output device.
  237. Output may be redirected to a file or the printer.  Works like the DOS ECHO
  238. command without parameters SHOULD have worked.
  239.  
  240.  
  241. DISPLAY DAY, DATE, AND TIME:
  242.  
  243. Key code T or T^.  The current day, date, and time are written on standard
  244. output like "Thu 06-May-1993 11:25:01.92".  This is useful for logging start
  245. and end times of a task.  For example, if you redirect the output of this
  246. function to a file after each backup, you can always see when your last backup
  247. was done:
  248.  
  249.       bu m Last backup done:
  250.       type last-bak.txt
  251.       backup ....
  252.       bu t >last-bak.txt
  253.  
  254.  
  255. SOUND:
  256.  
  257. Key code S or S^.  This function is useful for signalling the end of a long
  258. task, or errors.  Possible options are R(ed Alert), W(arble), N(oise), or
  259. G(lissando).  Run it without options and you'll get the default sound.
  260.  
  261.  
  262. WAIT:
  263.  
  264. Key code W or W^.  This function allows you to pause a batch job for a given
  265. number of seconds, and then continue automatically.  This can be used for
  266. displaying messages for 10 seconds, and then continuing.  If a key is pressed
  267. during the sleep process, the wait is terminated.  That way you don't have to
  268. wait the full 10 seconds, but continue as soon as you've finished reading the
  269. message.
  270.  
  271.  
  272. CLEAR SCREEN:
  273.  
  274. Key code ^ or ^^.  This function could replace the DOS CLS command because it
  275. maintains the coloured background and border (borders on CGA and VGA only).  Of
  276. course colours are irrelevant on monochrome displays and colour monitors in BW
  277. mode.
  278.  
  279.  
  280. SET CURSOR:
  281.  
  282. Key code _ or _^.  Use as parameters ON, OFF, or BIG.  ON and BIG set the
  283. cursor to normal and a full box respectively.  OFF hides the cursor.
  284.  
  285.  
  286.  
  287. Send your comments, suggestions, and bug reports to:
  288.  
  289.                               Mr. Gerry J. Danen
  290.                              106 Abbotsfield Road
  291.                            Edmonton, Alberta T5W 4S9
  292.                                     CANADA
  293.                                BBS: 403/477-9545
  294.                             CompuServe: 70672,1624
  295.                     Internet: gdanen@freenet.edmonton.ab.ca
  296.